home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#49 (Oct 89)
/
Jorgs Source
/
TestWindow.c
< prev
Wrap
Text File
|
1989-02-19
|
2KB
|
88 lines
/*
* Macintosh Window abstract class
*
* OIC-based access to the Mac Toolbox window manager.
*
* Copyright © John Wainwright 1988
*
* MetaClass :
*
* SuperClasses :
*
* Instance Vars :
*
* Class Vars :
*
* Methods :
*
* Class Methods :
*
*/
#include "oic.h"
#include "generics.h"
class Window; /* the Window class */
struct window_i /* Window instance structure */
{
WindowPtr window; /* the Mac window structure */
};
typedef struct window_i window_i;
enum { TITLE = 1, BOUNDS, KIND }; /* "new" keyword args */
/* -------------------- Window Instance methods --------------------------- */
static object
_new(self, w, wa)
object self;
register window_i *w;
register keyword_args wa;
{
w->window = NewWindow(NULL, key_arg(wa, BOUNDS, NULL),
key_arg(wa, TITLE, "Untitled"),
-1,
(int)key_arg(wa, KIND, 1L),
-1L, 1, self);
return Super(self, END);
}
static
_draw(self, w)
object self;
window_i *w;
{
object contents, item;
SetPort(w->window);
EraseRect(&w->window->portRect);
for (contents = sequence(self); item = next(contents); )
draw(item);
}
static object
_repList(self)
object self;
{
register replist replist;
replist = New(Replist, "{", "}", ":");
add(replist, className(self), Super(self), END);
return replist;
}
/* ------------------- Init the Window class ------------------------------- */
InitWindowClass()
{
Window = NewClass(sizeof(window_i), 0, "Window", List, END);
AddMethods(Window,
newGeneric, _new,
drawGeneric, _draw,
repListGeneric, _repList,
END);
}